//
//  KKComposeButton.swift
//  KKWeibo
//
//  Created by kassia on 16/7/20.
//  Copyright © 2016年 kassia. All rights reserved.
//

import UIKit

class KKComposeButton: UIButton {

    // 持有跳转控制器的模型
    var composeMenu: KKComposeMenu?
        
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    

    private func setupUI() {
    
        titleLabel?.font = UIFont.systemFontOfSize(15)
        setTitleColor(UIColor.grayColor(), forState: .Normal)
        titleLabel?.textAlignment = .Center // 文字居中
    
    }    
    // 重写高亮状态
    override var highlighted: Bool {
        
        get {
        
            return false
        }
        set {
        
        }
    }
    // 设置布局
    override func layoutSubviews() {
        super.layoutSubviews()
        // 设置控件的宽高
        imageView?.y = 0
        imageView?.weight = weight
        imageView?.height = weight
        
        titleLabel?.x = 0
        titleLabel?.y = weight
        titleLabel?.weight = weight
        titleLabel?.height = height - weight
        
    }

}
